package com.jrzh.mvc.model.sys;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.jrzh.framework.base.model.GeneralModel;

@Entity
@Table(name = "sys_login_logs")
public class LoginLogModel extends GeneralModel {
    
	@ManyToOne(fetch = FetchType.EAGER, optional = true, cascade = CascadeType.PERSIST, targetEntity = UserModel.class)
	@JoinColumn(name = "_user_id", referencedColumnName = "_id",insertable=false, updatable=false)
	@NotFound(action=NotFoundAction.IGNORE)
	private UserModel user;
	
    /**
     * 关联用户id
     */
    @Column(name = "_user_id")
    private String userId;
    
    /**
     * 登录时间
     */
    @Column(name = "_login_time")
    private Date loginTime;
    /**
     * 退出时间
     */
    @Column(name = "_login_out_time")
    private Date loginOutTime;
    /**
     * ip地址
     */
    @Column(name = "_ip")
    private String ip;
    
    
    /**
     * mac地址
     */
    @Column(name = "_mac_address")
    private String macAddress;
    
    /**
     * 描述
     */
    @Column(name = "_description")
    private String description;
    
    /**
     * 类型
     */
    @Column(name = "_type")
    private Integer type;
    

    public UserModel getUser() {
		return user;
	}

	public void setUser(UserModel user) {
		this.user = user;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public void setUserId(String userId) {
        this.userId = userId;
    }
    
    public String getUserId() {
        return this.userId;
    }
    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }
    
    public Date getLoginTime() {
        return this.loginTime;
    }
    public void setLoginOutTime(Date loginOutTime) {
        this.loginOutTime = loginOutTime;
    }
    
    public Date getLoginOutTime() {
        return this.loginOutTime;
    }
    public void setMacAddress(String macAddress) {
        this.macAddress = macAddress;
    }
    
    public String getMacAddress() {
        return this.macAddress;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    
    public String getDescription() {
        return this.description;
    }


}